/*
 * Created on 08.11.2006 14:38:43 Author: Josef Schneeberger (josef.schneeberger@fh-deggendorf.de)
 */
package pms.om;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @author josef@dr-schneeberger.de
 */
@Entity
@Table(name="tbl_BewDat")
public class BewDat {
    @Id
    @GeneratedValue
	@Column(name="pk_BewDat")
    private int id;
    private Date tStampKommt;
    private Date tStampGeht;
   
	

	@ManyToOne
	@JoinColumn(name = "fk_raum", nullable = false)
	private Raum raum;
	@ManyToMany(targetEntity = pms.om.Person.class,
			cascade={CascadeType.PERSIST},
			fetch = FetchType.LAZY)
	@JoinTable(
			name="zwtbl_person",
			joinColumns={@JoinColumn(name="fk_RaumGefunden")},
			inverseJoinColumns={@JoinColumn(name="fk_person")})
	private Set<Person> AnwPerson;

	public BewDat() {
		tStampKommt = new Date();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date gettStampKommt() {
		return tStampKommt;
	}

	public void settStampKommt(Date tStampKommt) {
		this.tStampKommt = tStampKommt;
	}

	public Date gettStampGeht() {
		return tStampGeht;
	}

	public void settStampGeht(Date tStampGeht) {
		this.tStampGeht = tStampGeht;
	}

	public Raum getRaum() {
		return raum;
	}

	public void setRaum(Raum raum) {
		this.raum = raum;
	}

	public Set<Person> getAnwPerson() {
		return AnwPerson;
	}

	public void setAnwPerson(Set<Person> AnwPerson) {
		this.AnwPerson = AnwPerson;
	}
	
	
}
